package com.mytrip.base.service.impl;

import java.io.Serializable;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.mytrip.base.dao.BaseDao;
import com.mytrip.base.model.BaseModel;
import com.mytrip.base.service.GenericManager;

/**
 * BaseManager Manager that talks to BaseDao to CRUD POJOs.
 */
public class GenericManagerImpl<T extends BaseModel, PK extends Serializable> extends BaseManagerImpl implements
		GenericManager<T, PK>{
	protected final Log log = LogFactory.getLog(getClass());

	protected BaseDao<T, PK> genericDao;

	public GenericManagerImpl(){

	}

	public GenericManagerImpl(BaseDao<T, PK> genericDao){
		this.genericDao = genericDao;
	}

	public boolean exists(PK id){
		return genericDao.exists(id);
	}

	public T get(PK id){
		return genericDao.get(id);
	}

	public List<T> getAll(){
		return genericDao.getAll();
	}

	public T save(T object){
		return genericDao.save(object);
	}

	public void remove(PK id){
		genericDao.remove(id);
	}

}
